<?php $this->load->helper('form');
//Programer note:	ID attributes used for client-side operations. (ID follows modular '_camelCase' control naming convention).
//Name attribute is used for Posting/Data operations.	(Name follows field name from database convention) 
?>
<!DOCTYPE html>
<html>
	<head>
		<title><?php echo $title;?></title>
		<?php echo link_tag('css/ppharm_popup.css'.'?'.time());?> 
		<?php echo link_tag('css/custom-theme/jquery-ui-1.8.2.custom.css'.'?'.time());?>
		<script type="text/javascript" src="<?php echo base_url().('/js/jquery.min.js');?>"></script>
		<script type="text/javascript" src="<?php echo base_url().('/js/jquery-ui.min.js');?>"></script>
		<script type="text/javascript" src="<?php echo base_url().('/js/common_form_functions.js').'?'.time();//TODO:  Version this once complete. Must timestamp so it will always update from cache?>"></script>
		<script type="text/javascript">
			$(document).ready(function() {	
					$("#_close").click(function() {
							if (!confirmNavigation())
								return false;
							window.opener.location.reload();
							window.close();
							return false;
							});

					//The following code is used to determine if the form is dirty or not.	used in conjunction with common_form_functions.js 
					//http://www.mydogboris.com/2009/10/using-jquery-data-feature-to-detect-form-changes/
					$('#_physicianForm input[type=text]').each(function (i) 
							{
								$(this).data('initial_value', $(this).val());
							});

					$('#_physicianForm input[type=text]').keyup(function() 
							{
								if ($(this).val() != $(this).data('initial_value')) 
									handleFormChanged();
							});

					$('#_physicianForm .editable').live('change paste', function() 
							{
							handleFormChanged();
							});

					//end dirty form code 
					
					<?php echo isset($additional_javascript_doc_ready_functions) ? $additional_javascript_doc_ready_functions : '' ; ?>

		})
		
		
		<?php echo isset($additional_jquery_javascript) ? $additional_jquery_javascript : '' ; ?>

		function my_url()
		{
			return '<?php echo site_url(); //Needed to reference website from javascript?>';
		}
		</script>
	</head>

	<body>

		<div class = "ppg-logo">
			<image src="<?php echo base_url().'/images/comp_logo.jpg';?>"/>
		</div>
		<div class="facility-name">
			<span style="padding-right: 100px; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 22px;">
				<?php echo $heading;?>
			</span>
			<?php echo $user_facility_name;?>
		</div>
		<div class = "clear-class"></div>
	
	<?php echo form_fieldset('','class = "small-popup-frameset"');?>
	<?php echo validation_errors(); ?>
	
	<?php 
	$this->load->helper('form');
	echo form_open('physician/'.$save_type, array('id'=>'_physicianForm'));
	?>
	
	
	<div>
		<?php //echo form_hidden('physician_id', $physician_id);?>
		<input type="hidden" name="physician_id" id="id" value="<?php echo $physician_id;?>" />
		<?php echo form_hidden('uri',$this->uri->uri_string());?>
	
				 
		<?php echo form_label('Last Name:', '_lastName');?>
				<input type="text" id="_lastName" name = "last_name" value="<?php echo set_value('last_name', $last_name); ?>" size="50" autocomplete="off" />
				<br class="clear" />
				
		<?php echo form_label('First Name:', '_firstName');?>
				<input type="text" id="_firstName" name = "first_name" value="<?php echo set_value('first_name', $first_name); ?>" size="50" autocomplete="off" />
				<br class="clear" />
				
		<?php echo form_label('Group:', '_physician_group');?>
			<?php echo form_dropdown('physician_group', $physician_group_list, $physician_group_id, 'id = "_physician_group" class="editable"'); //The 4th parameter is the js option?>
			<br class="clear" />

		<?php echo form_label('Active:', '_active');?>
				<?php echo form_checkbox($active_checkbox);?>
				<br class="clear" />

	</div> 
	<div class="small-popup-button-class"> 
		<input name="save" id="_save" type="submit"	value="Ok"/>
		<button name="close" id="_close" />Close</button>
	</div>
	<?php echo form_fieldset_close(); //Small Pop-up Fieldset ?>
	
		<div class="navigation-bar">
			<?php echo isset($nav_bar) ? $nav_bar : '' ; ?>
		</div>		
		
	<?php	echo form_close(); ?>
	<div class="footer">
		<?php echo form_label('Date added:', '_createdDate');?><input type="text" id="_createdDate" name = "created_date" readonly="readonly" tabindex="-1" value="<?php echo set_value('created_date', $created_date); ?>" size="50" autocomplete="off" />		
		<?php echo form_label('Last Modified:', '_modifiedDate');?><input type="text" id="_modifiedDate" name = "modified_date" readonly="readonly" tabindex="-1" value="<?php echo set_value('modified_date', $modified_date); ?>" size="50" autocomplete="off" />
	</div>		
	</body>
</html>
